package com.demo.demo.singleton;

import sun.security.jca.GetInstance;

/**
 * 饿汉模式
 */
public class Hungry {
    //会造成空间浪费
    private byte [] aByte = new byte[1024*1024];
    private byte [] aByte1 = new byte[1024*1024];
    private byte [] aByte2 = new byte[1024*1024];
    private byte [] aByte3 = new byte[1024*1024];
    private byte [] aByte4 = new byte[1024*1024];
    private byte [] aByte0 = new byte[1024*1024];
    private byte [] aByte49 = new byte[1024*1024];
    private byte [] aByte3j = new byte[1024*1024];
    private byte [] aByte4k= new byte[1024*1024];
    private byte [] aByte3k = new byte[1024*1024];
    private byte [] aByte4w = new byte[1024*1024];
    private byte [] a = new byte[1024*1024*1024*1024];
    private byte [] aByte4c = new byte[1024*1024];
    private Hungry(){

    }
    private final static Hungry hungry = new Hungry();

    public static Hungry getInstance(){
        return hungry;
    }


    public static void main(String[] args) {
        Hungry hungry = getInstance();
        Hungry hungry1 = getInstance();
        System.out.println(hungry);
        System.out.println(hungry1);
    }

}
